home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / June 96 / Re DoIdle.6 < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  1.9 KB  |  [TEXT/ttxt]

  1. Subject:     Re: DoIdle
  2. Sent:        6/14/96 9:35 AM
  3. Received:    6/14/96 9:57 AM
  4. From:        Henri Lamiraux, lamiraux@apple.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. >I have a LabelShape (a CBaseShape in ODFDraw or Sketch code) that requires
  9. >an idler in order to blink the caret in the label. When it gets to be time
  10. >to edit the label I make an FW_CEditView then do this:
  11. >  in EditLabel()
  12. >     fEditView->Enable(ev);
  13. >        fEditView->BecomeTarget( ev );
  14. >
  15. >        if( fIdler == NULL )
  16. >        {
  17. >                fIdler = FW_NEW(FW_CIdler, (fEditView->GetFrame(ev), 5));
  18. >                fIdler->RegisterIdle(ev);
  19. >        }
  20. >
  21. >Later when the Label is deselected by the user I do this
  22. >in SelectLabel( FW_Boolean state )
  23. >    if( !state)
  24. >    {
  25. >       fEditView->Disable(ev);
  26. >       if( fIdler )
  27. >       {
  28. >           fIdler->UnregisterIdle( ev );
  29. >
  30. >           delete fIdler;
  31. >           fIdler = NULL;
  32. >        }
  33. >    }
  34. >
  35. >Sometime or other, you need to delete the idler. I do it when the Edit View
  36. >is deleted
  37. >                if( fIdler )
  38. >                {
  39. >                        fIdler->UnregisterIdle( ev );
  40. >
  41. >                        delete fIdler;
  42. >                        fIdler = NULL;
  43. >                }
  44. >
  45. >Hope this helps
  46. >
  47. >Arni
  48. >
  49. >
  50.  
  51. You should not have to create and delete the idler everytime. Calling 
  52. Register and Unregister should be enough. Have you tried to create the 
  53. idler when the frame is created and call Register when the edit view 
  54. becomes the target and Unregister when it looses the target.
  55.  
  56. ........................................................................
  57.  Henri Lamiraux                                      lamiraux@apple.com
  58.  Apple Computer, Inc.                 OpenDoc(tm) Development Framework
  59. ........................................................................
  60.  
  61.